local skel = fk.CreateSkill{
  name = "tea__zhenqu",
}
--local U = require "packages/utility/utility"
Fk:loadTranslationTable{
  ["tea__zhenqu"] = "振躯",
  [":tea__zhenqu"] = "出牌阶段限一次，你可以将一张牌当【决斗】使用。此牌指定目标后，目标角色须选择一项：1.此牌结算两次；2.此牌的结算方式改为轮流分配一张【闪】（不能为对方分配）。",
  ["#tea__zhenqu-invoke"] = "振躯：你可以将一张牌当【决斗】使用",
  ["tea__zhenqu_twice"] = "令此【决斗】结算两次",
  ["tea__zhenqu_jink"] = "令此【决斗】改为轮流分配【闪】",
}
---@type ViewAsSkillSpec
local zhenqu = {
  anim_type = "special",
  pattern = "duel",
  prompt = "#tea__zhenqu-invoke",
  enabled_at_play = function (self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
  end,
  enabled_at_response = Util.FalseFunc,
  card_filter = function (self, player, to_select, selected, selected_targets)
    return #selected == 0
  end,
  view_as = function (self, player, cards)
    if #cards ~= 1 then return end
    local c = Fk:cloneCard("duel")
    c.subcards = cards
    c.skillName = skel.name
    return c
  end,
}
---@type TrigSkelSpec<AimFunc>
local zhenqu_delay = {
  mute = true,
  can_trigger = function (self, event, target, player, data)
    return table.contains(data.card.skillNames, skel.name) and player:hasSkill(skel.name) and not data.to.dead
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local to = data.to
    local choice = room:askToChoice(to, {
      choices = { "tea__zhenqu_twice", "tea__zhenqu_jink" },
      skill_name = skel.name,
      cancelable = false,
    })
    if choice == "tea__zhenqu_twice" then
      data.use.additionalEffect = 1
    else
      ---@diagnostic disable-next-line: assign-type-mismatch      
      data.card.skill = Fk.skills["tea__zhenqu__duel_skill"]
    end
  end
}
skel:addEffect("viewas", zhenqu)
skel:addEffect(fk.TargetSpecified, zhenqu_delay)
-- Fk.generals["mouxusheng"]:addSkill(skel.name)
return skel